﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.AUTO.Adjust.Dto;
using NP.BPMReportPlatform.AUTO.Quotation.Dto;
using NP.BPMReportPlatform.AUTO.TechnicalDependence.Dto;
using NP.BPMReportPlatform.IUDefectiveProduct.Dto;
using NP.BPMReportPlatform.IUTS;
using NP.BPMReportPlatform.IUTS.Dto;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.IUDefectiveProduct
{
    /// <summary>
    ///IUIU不良品处理
    /// </summary>
    //[Authorize]
    [ApiController]
    [Route("api/iudefectiveproduct")]
    public class IUDefectiveProductController : BPMReportPlatformController
    {
        private readonly IIUDefectiveProductAppService _iczhylsService;

        public IUDefectiveProductController(IIUDefectiveProductAppService iczhylsService)
        {
            _iczhylsService = iczhylsService;
        }

        /// <summary>
        ///IU不良品处理审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("IUDefectiveProduct/GetAllAsync")]
        public async Task<PagedResultDto<IUDefectiveOutput>> GetAllAsync([FromBody] GetIUDefectiveInput input)
        {
            return await _iczhylsService.GetAllAsync(input);
        }

        /// <summary>
        ///IU不良品处理审批流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("IUDefectiveProduct/Export1Async")]
        public async Task<XlsxFileResult<ExportIUDefectiveOutput>> Export1Async([FromBody] GetIUDefectiveInput input)
        {
            var rst = await _iczhylsService.Export1Async(input);
            return new XlsxFileResult<ExportIUDefectiveOutput>(rst, "导出Excel");
        }
    }
}
